package com.qqt.csr.archive.batch.task.context;

import cn.hutool.json.JSONUtil;
import com.qqt.csr.archive.entity.reader.ArtificialMessage;
import com.qqt.csr.archive.entity.reader.CsrImAccount;
import com.qqt.csr.archive.entity.reader.SmartMessage;
import com.qqt.csr.archive.entity.writer.ArchiveConversation;
import com.qqt.csr.archive.entity.writer.ArchiveMessage;
import com.qqt.csr.archive.enums.SourceType;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @Author: yang hao
 * @Date: 2024/11/19 14:25
 * @Description: 消息归档任务上下文
 **/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class MessageArchiveTaskContext {

    /**
     * 会话id
     */
    private String conversationId;

    /**
     * 来源
     */
    private SourceType source;

    /**
     * 归档会话
     */
    private ArchiveConversation conversation;

    /**
     * 客服/机器人账户
     */
    private CsrImAccount csAccount;

    /**
     * 访客账户
     */
    private CsrImAccount userAccount;

    /**
     * 人工客服消息集
     */
    private List<ArtificialMessage> artificialMessages;

    /**
     * 智能客服消息集
     */
    private List<SmartMessage> smartMessages;

    /**
     * 归档消息
     */
    private List<ArchiveMessage> archiveMessages;

    /**
     * 转为json字符串
     * @return {@link String} json字符串
     */
    public String toJsonString() {
        return JSONUtil.toJsonStr(this);
    }

}
